$(function () {
	
	
	
	// var url='http://api.yubao521.com/api/article';
	
	// $.ajax({
	//   url:url,
	//   type:'GET',
	//   dataType:'JSON',
	//   success: (res) => {
	//       // 状态码 200 表示请求成功
	//       if(res.code === 200){
	//         //console.log(res.data)
	// 	let data = res.data.data;
	// 	            for(var i=0;i<data.length;i++){
	// 	                console.log("id是：" + data[i].id);
	// 	            }

			
	//       }else{
	//         console.log(res)
	//       }
	//   }
	// })
	
	

		  
		  
    //     success: function (res) {
    //         var outStr = "";
    //         var html = "";
    //         //console.log(res)
    //         if (res.data === undefined) {
    //             outStr = "<p>暂无相片</p>"
    //             html = "<p>暂无相片</p>";
    //             // $('.picbox').append(outStr)
    //             //$('#div_photo').append(html)
    //         } else {
    //             var index = 0;
				// let data = res.data.data;
    //             for (var i=0;i<data.length;i++) {
    //                 index++;
    //                 var imgArr = res.data[i].img;
                
					
				// 	// //获取滚动图片
							
				// 	html +=	'<article class="featured">'+
				// 			'<div class="overlay"></div>'+
				// 			'<figure>'+
				// 			'<img src="' + imgArr + '" alt="Sample Article">'+
				// 			'</figure>'+
				// 			'<div class="details">'+
				// 			'<div class="category"><a href="category.html">Computer</a></div>'+
				// 			'<h1><a href="single.html">Phasellus iaculis quam sed est elementum vel ornare ligula venenatis</a></h1>'+
				// 			'<div class="time">December 26, 2016</div>'+
				// 			'</div>'+
				// 			'</article>';		
							
							
							

    //                 if (index % 4 == 0) {
    //                     index = 0;
    //                 }
    //                 //$('.picbox>ul').eq(index).append(outStr)

    //             }
    //             $('#gundong').append(html);
    //            /* $('#div_photo').viewer({
    //                 url: 'data-original',
    //                  //navbar: 'true' 
    //             });*/
                

    //         }

    //     },
    //     error: function (XMLHttpRequest, textStatus, errorThrown) {
    //         alert(XMLHttpRequest.readyState);
        
    // });
	
	
	    $.ajax({
	        url: "http://api.yubao521.com/api/banner",
	        type: "GET",
	        async: false,
	        dataType: "json",
	        // contentType: "charset=utf-8",
	        cache: false,
	        //4 接受返回过来的数据，同样是json格式的，根据返回过来的数据给出相应的提示或操作
	        success: function (res) {
	            var outStr = "";
	            var html = "";
	            console.log(res)
	            if (res.data === undefined) {
	                outStr = "<p>暂无相片</p>"
	                html = "<p>暂无相片</p>";
	                // $('.picbox').append(outStr)
	                //$('#div_photo').append(html)
	            } else {
	                var index = 0;
					let data = res.data.data;
	                for (var i=0;i<data.length;i++) {
	                    index++;
	                    var imgArr = data[i].img;
	            
	
	                    	html +=	'<div class="card-body p-0 d-flex">'+
                                    '<figure class="avatar me-3">'+
									'<img src="images/user-7.png" alt="image" class="shadow-sm rounded-circle w45">'+
									'</figure>'+
                                    '<h4 class="fw-700 text-grey-900 font-xssss mt-1">"' + 作者+ '"<span class="d-block font-xssss fw-500 mt-1 lh-3 text-grey-500">"' +3 hour ago+ '"</span></h4>'+
                                    '<a href="#" class="ms-auto" id="dropdownMenu2" data-bs-toggle="dropdown" aria-expanded="false"><i class="ti-more-alt text-grey-900 btn-round-md bg-greylight font-xss"></i></a>'+
                                    '<div class="dropdown-menu dropdown-menu-end p-4 rounded-xxl border-0 shadow-lg" aria-labelledby="dropdownMenu2">'+
                                    '<div class="card-body p-0 d-flex">'+
                                    '<i class="feather-bookmark text-grey-500 me-3 font-lg"></i>'+
                                    '<h4 class="fw-600 text-grey-900 font-xssss mt-0 me-4">Save Link <span class="d-block font-xsssss fw-500 mt-1 lh-3 text-grey-500">Add this to your saved items</span></h4>'+
                                    '</div>'+
                                    '<div class="card-body p-0 d-flex mt-2">'+
                                    '<i class="feather-alert-circle text-grey-500 me-3 font-lg"></i>'+
                                    '<h4 class="fw-600 text-grey-900 font-xssss mt-0 me-4">Hide Post <span class="d-block font-xsssss fw-500 mt-1 lh-3 text-grey-500">Save to your saved items</span></h4>'+
                                    '</div>'+
                                    '<div class="card-body p-0 d-flex mt-2">'+
                                    '<i class="feather-alert-octagon text-grey-500 me-3 font-lg"></i>'+
                                    '<h4 class="fw-600 text-grey-900 font-xssss mt-0 me-4">Hide all from Group <span class="d-block font-xsssss fw-500 mt-1 lh-3 text-grey-500">Save to your saved items</span></h4>'+
                                    '</div>'+
                                    '<div class="card-body p-0 d-flex mt-2">'+
                                    '<i class="feather-lock text-grey-500 me-3 font-lg"></i>'+
                                    '<h4 class="fw-600 mb-0 text-grey-900 font-xssss mt-0 me-4">Unfollow Group <span class="d-block font-xsssss fw-500 mt-1 lh-3 text-grey-500">Save to your saved items</span></h4>'+
                                    '</div>'+
                                    '</div>'+
									'</div>'+
									'<div class="card-body p-0 me-lg-5">'+
								    '<p class="fw-500 text-grey-500 lh-26 font-xssss w-100">'+
									'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Morbi nulla dolor, ornare at commodo non, feugiat non nisi. Phasellus faucibus mollis pharetra. Proin blandit ac massa sed rhoncus '+
									'<a href="#" class="fw-600 text-primary ms-2">See more</a>'+
									'</p>'+
								    '</div>'+
									'<div class="card-body d-block p-0">'+
									     '<div class="row ps-2 pe-2">'+
									         '<div class="col-xs-4 col-sm-4 p-1">'+
											 '<a href="images/t-10.jpg" data-lightbox="roadtrip">'+
											 '<img src="images/t-10.jpg" class="rounded-3 w-100" alt="image">'+
											 '</a>'+
											 '</div>'+
									         '<div class="col-xs-4 col-sm-4 p-1">'+
											 '<a href="images/t-11.jpg" data-lightbox="roadtrip">'+
											 '<img src="images/t-11.jpg" class="rounded-3 w-100" alt="image">'+
											 '</a>'+
											 '</div>'+
									         '<div class="col-xs-4 col-sm-4 p-1">'+
											 '<a href="images/t-12.jpg" data-lightbox="roadtrip" class="position-relative d-block">'+
											 '<img src="images/t-12.jpg" class="rounded-3 w-100" alt="image">'+
											 '<span class="img-count font-sm text-white ls-3 fw-600"><b>+2</b></span>'+
											 '</a>'+
											 '</div>'+
									     '</div>'+
									 '</div>'+
									 
	
	                    if (index % 4 == 0) {
	                        index = 0;
	                    }
	                    //$('.picbox>ul').eq(index).append(outStr)
	
	                }
	               // $('#gd1').append(html);
	               
	                
	
	            }
	
	        },
	        error: function (XMLHttpRequest, textStatus, errorThrown) {
	            alert(XMLHttpRequest.readyState);
	        }
	    });
	
	
	
	
	
	
});